Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@globalfishingwatch/layer-composer
Advanced tools
The LayerManager orchestrates various **Layer Generators** in order to generate an entire Mapbox GL Style document that can be used with Mapbox GL and/or react-map-gl.
The LayerManager orchestrates various Layer Generators in order to generate an entire Mapbox GL Style document that can be used with Mapbox GL and/or react-map-gl.
new LayerManager(config?)
{
generators: Generator[],
glyphs: string,
sprites: string
}
Instanciates a new Layer Manager that will use the provided Layer Generators.
Draft
`layerManager.getEvent(event: GLEvent): GFWEvent`.
Converts a native Mapbox GL event into a GFW event to be used in clients (takes into account popup info, variable formatting, priority, etc).
Converts provided LayerDefinitions, using Generators, to a usable Mapbox GL JSON style object.
layerManager.getGLStyle(layers: LayerDefinition[]): { GLStyle, [promises] }
Returns the sync glStyle and an array of promises when async layers are loaded which will pass the updated GLStyle and the layer as params when layer is ready
String. Mandatory. Use constants stored in the generator.
import { TYPES } from '@globalfishingwatch/map-components/components/layer-manager'
String. Must be specified if several layers from the same generator are to be used, otherwise the type will be used as id.
new Generator(config?): void
Generators define, for a varying set of any inputs, a way to generate both GL source(s) and layer(s) for a given type of layer.
Generators each contain the styling information they need, which can take the form of a customizable bit of GL style json, or something entirely dynamic.
See Generators section below.
String. Mandatory. Defines uniquely the type of each generator, required in layer types
generator.getStyle(layer: LayerDefinition): { id: string, layers: GLLayer[], sources: GLSource[] }
Returns an object with the unique identifier and an array of sources
and layers
needed by the layers.
The Layer Manager Component is a React component that takes a ReactMapGL
component as a child and pass its props using the render props pattern.
Parameters availables:
import LayerManager, { TYPES } from '@globalfishingwatch/map-components/components/layer-manager'
import defaultGenerators from '@globalfishingwatch/map-components/components/layer-manager/generators'
// optional step as common generators will be used by default
const generators = { ...defaultGenerators, { custom: new CustomGenerator()} }
<LayerManager
config={{
generators
}}
layers={[
{
type: TYPES.BACKGROUND,
color: '#00265c',
},
{
type: TYPES.BASEMAP,
id: 'satellite',
},
{
type: TYPES.CARTO_POLYGONS,
id: 'RFMO',
color: '#ff00ff',
},
]}
onClick={(event) => {
setState...
}}
>
{(mapStyle, loading, onClick, onHover, cursor) => {
return <ReactMapGL
mapStyle={mapStyle}
onClick={onClick}
onHover={onHover}
cursor={cursor}
...
/>
}}
</LayerManager>
This library also exposes a React hook to get the mapStyles definition:
import { useLayerManager} } from '@globalfishingwatch/map-components/components/layer-manager'
const [mapStyles, loading] = useLayerManager(layers, config)
To be defined
FAQs
Unknown package
The npm package @globalfishingwatch/layer-composer receives a total of 81 weekly downloads. As such, @globalfishingwatch/layer-composer popularity was classified as not popular.
We found that @globalfishingwatch/layer-composer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.